%%%-------------------------------------------------------------------
%%% @author liuwentao
%%% @doc
%%%     背包道具数据升级
%%% @end
%%% Created : 19. 7月 2021 20:37
%%%-------------------------------------------------------------------
-module(package_ver).
-author("liuwentao").

%% API
-export([
    do/1
]).

-include("package.hrl").
-include("common.hrl").

%% @doc 物品数据版本转换
do(P = #package{items = ItemsBag}) ->
    case item_ver:do_items(ItemsBag, []) of
        {ok, NewItems} ->
            {ok, P#package{items = NewItems}};
        Err ->
            Err
    end;
do(P) ->
    ?ERR("物品数据转换:~w", [P]),
    {false, "物品数据版本转换失败"}.